const url = require('url');
const http = require('http')
const https = require('https')

const server = http.createServer((req, res) => {
  https.get('https://cnodejs.org', (resp) => {
    let data = ''
    resp.on('data', chunk => {
      data += chunk
    })
    resp.on('end', () => {
      res.writeHead(200, {
        'Content-Type': 'application/json;chartset=utf-8'
      })
      res.end(data)
    })
  })
}).listen(3003, '127.0.0.1')

console.log('监听127.0.0.1:3003，服务启动')